package com.siwen.util;

import com.siwen.api.ApiResult;
import com.siwen.common.ErrorCode;

public class ResultUtil {

    public static ApiResult success() {
       return success(null);
    }

    public static ApiResult success(Object data){
        ApiResult apiResult = new ApiResult();
        apiResult.setCode(ErrorCode.OK.getCode());
        apiResult.setMessage("请求成功");
        apiResult.setData(data);
        return apiResult;
    }


    public static ApiResult error(int code,String message) {
        ApiResult apiResult = new ApiResult();
        apiResult.setCode(code);
        apiResult.setMessage(message);
        return apiResult;
    }
}
